﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Commons.Entity;
using Background.Core.Entity;
using System.Linq.Expressions;

namespace Background.Core.DAL
{
    public class WebDepartmentsRepository : BackgroundRepositoryBase
    {
        /// <summary>
        /// 分页结果集
        /// </summary>
        /// <param name="predicate"></param>
        /// <param name="pp"></param>
        /// <returns></returns>
        public PagedList<WebDepartments> GetWebDepartments(Expression<Func<WebDepartments, bool>> predicate, PagingParam pp)
        {
            var linq = base.GetEntities<WebDepartments>();
            if (predicate != null)
                linq = linq.Where(predicate);
            return linq.ToPagedList(pp.PageIndex, pp.PageSize);
        }
    }
}